home *** CD-ROM | disk | FTP | other *** search
- /
- / trap handler to allow user to enable/disable interrupts.
- / this trap handler will be installed by the ioinit() C routine. (atari.c)
- /
- / the desired processor priority level is passed as a parameter, and the
- / previous level will be returned in the lower 3 bits of D0
- /
- / adapted to non-68000 systems by testing the Atari-defined word _longframe
- / at 0x59e. when it is nonzero we are running on a processor which pushes
- / an extra word (vector table offset) on the stack when handling exceptions.
- /
- .globl trap_x_
- .shri
- trap_x_:
- /
- / get proper stack pointer to access argument
- /
- movea.l usp,a0 / assume user stack for now
- btst $5,(sp) / test for supervisor mode
- beq.s got_it / no, so usp is the correct ptr
- lea 6(sp),a0 / pt to arg on 68000 supervisor stack
- move.w 0x59e,d0 / test the _longframe indicator
- beq.s got_it / is a 68000, go
- lea 8(sp),a0 / pt to arg on 680x0 (x != 0)
- got_it:
- /
- / get arg and move in position
- /
- move.w (a0),d0
- lsl.w $8,d0
- /
- / modify the status register on top of supervisor stack
- /
- andi.w $0xf8ff,(sp) / clear the IPL bits
- or.w d0,(sp) / insert the new value
- /
- / read current processor level and move to lower bits
- /
- move.w sr,d0
- lsr.w $8,d0
- andi.w $7,d0 / isolate the IPL bits
- /
- / "return from exception" will pop new processor level in SR
- /
- rte
-